<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Article;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\Enclosure */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="enclosure-form">

    <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>

    <?= $form->field($model, 'xa_article_id')->dropDownList(ArrayHelper::map(Article::find()->asArray()->all(),'id','xa_title'),['id'=>'type']) ?>

    <?= $form->field($model, 'xa_type')->dropDownList(['1'=>'图片','2'=>'视频','3'=>'文件'],['prompt'=>'请选择附件类型','style'=>'width:300px']) ?>

    <?= $form->field($model, 'xa_name[]')->fileInput(['multiple' => true]) ?>

    <?= $form->field($model, 'xa_title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'xa_abstract')->textInput(['maxlength' => true]) ?>

    <?//= $form->field($model, 'xa_create_time')->textInput(['maxlength' => true]) ?>

    <?//= $form->field($model, 'xa_update_time')->textInput(['maxlength' => true]) ?>

    <?//= $form->field($model, 'xa_remark')->textInput(['maxlength' => true]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '创建' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
